package com.qingxin.cms.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * 文章分类
 */
@Entity
@Table(name = "cms_category")
public class CmsCategory extends com.qingxin.sys.entity.BaseEntity implements
		java.io.Serializable {
	private static final long serialVersionUID = -4213572215278317360L;
	
	private String categoryId;
	private String categoryCode;
	private String categoryName;
	private String createBy;
	private Date createTime;
	private String updateBy;
	private Date updateTime;
	private String isPark;
	private String isSys;
	private Set<CmsArticle> cmsArticles = new HashSet<>(0);

	// Constructors

	/** default constructor */
	public CmsCategory() {
	}
	
	public CmsCategory(String categoryId) {
		super();
		this.categoryId = categoryId;
	}
	
	
	public CmsCategory(String categoryId, String categoryName) {
		super();
		this.categoryId = categoryId;
		this.categoryName = categoryName;
	}

	public CmsCategory(String categoryId, String categoryCode,
			String categoryName, String createBy, Date createTime,
			String updateBy, Date updateTime) {
		super();
		this.categoryId = categoryId;
		this.categoryCode = categoryCode;
		this.categoryName = categoryName;
		this.createBy = createBy;
		this.createTime = createTime;
		this.updateBy = updateBy;
		this.updateTime = updateTime;
	}

	/** full constructor */
	public CmsCategory(String categoryCode, String categoryName,
			String createBy, Date createTime, String updateBy,
			Date updateTime, String isPark, String isSys,
			Set<CmsArticle> cmsArticles) {
		this.categoryCode = categoryCode;
		this.categoryName = categoryName;
		this.createBy = createBy;
		this.createTime = createTime;
		this.updateBy = updateBy;
		this.updateTime = updateTime;
		this.isPark = isPark;
		this.isSys = isSys;
		this.cmsArticles = cmsArticles;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "category_id", unique = true, nullable = false, length = 32)
	public String getCategoryId() {
		return this.categoryId;
	}

	public void setCategoryId(String categoryId) {
		this.categoryId = categoryId;
	}

	@Column(name = "category_code", length = 20)
	public String getCategoryCode() {
		return this.categoryCode;
	}

	public void setCategoryCode(String categoryCode) {
		this.categoryCode = categoryCode;
	}

	@Column(name = "category_name", length = 50)
	public String getCategoryName() {
		return this.categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	@Column(name = "create_by", length = 32)
	public String getCreateBy() {
		return this.createBy;
	}

	public void setCreateBy(String createBy) {
		this.createBy = createBy;
	}

	@Column(name = "create_time", length = 23)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "update_by", length = 32)
	public String getUpdateBy() {
		return this.updateBy;
	}

	public void setUpdateBy(String updateBy) {
		this.updateBy = updateBy;
	}

	@Column(name = "update_time", length = 23)
	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	@Column(name = "is_park", length = 1)
	public String getIsPark() {
		return this.isPark;
	}

	public void setIsPark(String isPark) {
		this.isPark = isPark;
	}

	@Column(name = "is_sys", length = 1)
	public String getIsSys() {
		return this.isSys;
	}

	public void setIsSys(String isSys) {
		this.isSys = isSys;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cmsCategory")
	public Set<CmsArticle> getCmsArticles() {
		return this.cmsArticles;
	}

	public void setCmsArticles(Set<CmsArticle> cmsArticles) {
		this.cmsArticles = cmsArticles;
	}

}